package com.whiteape.book.ui.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import androidx.appcompat.widget.Toolbar;

import com.whiteape.book.R;
import com.whiteape.book.ui.activity.SearchCategoryActivity;
import com.whiteape.book.ui.activity.SiteSourceCategoryActivity;
import com.whiteape.book.ui.activity.SiteSourceManageActivity;
import com.whiteape.book.ui.base.BaseFragment;
import com.whiteape.book.utils.ToastUtils;

import butterknife.BindView;
import butterknife.OnClick;

public class DiscoveryFragment extends BaseFragment {


    @BindView(R.id.toolbar)
    Toolbar toolbar;
    @Override
    protected void initView(Bundle savedInstanceState) {
        super.initView(savedInstanceState);
        if (getContext() != null) {
            toolbar.setBackgroundColor(getContext().getResources().getColor(R.color.colorAccent));
        }
    }


    @Override
    protected int getContentId() {
        return R.layout.fragment_discovery;
    }

    @OnClick({R.id.rl_discovery_video,
            R.id.rl_discovery_homepage_setting,
            R.id.rl_discovery_search_category,
            R.id.rl_discovery_site_source_category,
            R.id.rl_discovery_site_source_manage
    })
    public void onViewClicked(View view) {
        if (getContext() == null) {
            return;
        }
        switch (view.getId()) {
            case R.id.rl_discovery_site_source_manage:
                startActivity(new Intent(getContext(), SiteSourceManageActivity.class));
                break;
            case R.id.rl_discovery_site_source_category:
                startActivity(new Intent(getContext(), SiteSourceCategoryActivity.class));
                break;
            case R.id.rl_discovery_search_category:
                startActivity(new Intent(getContext(), SearchCategoryActivity.class));
                break;
            case R.id.rl_discovery_homepage_setting:
                break;
            case R.id.rl_discovery_video:
                ToastUtils.show("开发中...敬请期待！");
                break;
        }

    }
}
